﻿<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Pzgl_KjFzHsExport.aspx.vb" Inherits="PubProject.Pzgl_KjFzHsExport"%>
<%@ Register TagPrefix="cnt" Namespace="Mysoft.Map.Application.Controls" Assembly="Mysoft.Map.Application.Components" %>
<%@ Register TagPrefix="mnu" Namespace="Mysoft.Map.Application.Menus" Assembly="Mysoft.Map.Application.Components" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title></title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<link rel="stylesheet" type="text/css" href="/_grid/map_grid.css">
		<link rel="stylesheet" type="text/css" href="/_nav/menu.css">
		<script language="javascript" src="/Hyxt/js/Public.js"></script>
		<script language="javascript" src="/_common/scripts/global.js"></script>
		<link rel="stylesheet" type="text/css" href="/_forms/styles/form.css">
		<link rel="stylesheet" type="text/css" href="/_controls/find/find.css">
		<link rel="stylesheet" type="text/css" href="/_common/styles/global.css">
		<script language="javascript" src="/_controls/settings.aspx"></script>
		<script language="javascript" src="/_controls/util/util.js"></script>
		<script language="javascript" src="/_controls/datetime/date.js"></script>
		<script language="javascript" src="/_controls/number/number.js"></script>
		<script language="javascript" src="/_nav/menu.js"></script>		
		<script language="javascript" src="/PubProject/JS/Public.js"></script>
			<script language="javascript" src="/_controls/UpFile/UpFile.js"></script>
		<script language="javascript">
		    var _MyHelpfile = "/Cbgl/Help/topics/财务人员/凭证管理/会计辅助核算输出.html";
		    function window.onload()
		    {

		        var sCwztGUID = document.all.ddlCwzt.value;
		        if (!sCwztGUID || sCwztGUID=="" || sCwztGUID=="undefined")
		        {
		            var rdNum = Math.random();
				    document.all("appIframe").src="Pzgl_KjFzHsExport_Grid.aspx"
											 + "?rdnum=" + rdNum;
		            return;
		        }
		        else
		        {
		            SetFzhsxm(sCwztGUID);
		        }
		        if( document.all("__Application") && document.all("__Application").value=="0101")
                {	           
                    _MyHelpfile = "/Slxt/HELP/topics/财务管理/凭证管理.html";
                }
		    }
		    
		    
		    //设置辅助核算项目
		    function SetFzhsxm(sCwztGUID)
	        {
		        
		        var sFile = "/PubProject/Cwjk/Pzgl_XMLHTTP.aspx?CwztGUID=" + sCwztGUID;
		        var sRtn = openXMLHTTP(sFile,"GetFzhsxm");
    			
		        if(sRtn != "FAIL")
		        {
			        document.all("tdProject").innerHTML = "<select name='SelectProject' style='width:100%' onchange='SelectFzhsxm()'>"
										        + sRtn
										        + "</select>";
		        }
		        
		        SetButton(sCwztGUID);
		        SelectFzhsxm();
		        setDefaultCwzt();
	        }
	        function setDefaultCwzt()
            {
                try
                {
                    var sCwztGUID = document.all["ddlCwzt"].value;
                    var sFile = "/PubProject/Cwjk/Pzgl_XMLHTTP.aspx?CwztGUID="+ escape(sCwztGUID) + "&ObjType=DefaultCwzt_CB";
                    var sReturn = openXMLHTTP(sFile,"SetDefaultCwzt");
                }
                catch(e){}
            }
		        
		    //选择辅助核算项目  
		    function SelectFzhsxm()
		    {
		        //处理相关业务调用
				var sCwztGUID = document.all.ddlCwzt.value;
				var sHsTypeGUID = document.all.SelectProject.value;
				
				if (!sHsTypeGUID || sHsTypeGUID=="" || sHsTypeGUID=="undefined")
		        {
		            return;
		        }
		        
				var rdNum = Math.random();
				document.all("appIframe").src="Pzgl_KjFzHsExport_Grid.aspx"
											 + "?CwztGUID=" + escape(sCwztGUID) 
											 + "&HsTypeGUID=" + escape(sHsTypeGUID)
											 + "&rdnum=" + rdNum;
		    }
		    
		    
		    //设置按钮
		    function SetButton(sCwztGUID)
		    {
		        var sFile = "/PubProject/Cwjk/Pzgl_XMLHTTP.aspx?CwztGUID=" + sCwztGUID;
		        var sRtn = openXMLHTTP(sFile,"GetCwjkSoftVesion");
    			
		        if(sRtn != "FAIL" && (sRtn=="用友 NC 5.5" || sRtn=="用友NC5.5"))
		        {
		            document.all("btnExport").disabled = false;
		            document.all("btnRenewExport").disabled = false;
		        }
		        else
		        {
		            document.all("btnExport").disabled = true;
		            document.all("btnRenewExport").disabled = true;
		        }
		        
		        if(document.getElementById("txtRight").value != "True")
		        {
		            document.all("btnExport").disabled = true;
		            document.all("btnRenewExport").disabled = true;
		        }
		    }

		    function Export(iType) { 
		        //判断是否选择了账套
		        if (document.all.ddlCwzt.length == 0 || document.all.ddlCwzt.value == "") {
		            alert("请选择一个账套！");
		            return;
		        }

		        //判断是否选择了账套
		        if (document.all.SelectProject.length == 0 || document.all.SelectProject.value == "") {
		            alert("请选择一个会计辅助核算项目！");
		            return;
		        }

		        var sFile = "/PubProject/Cwjk/Pzgl_XMLHTTP.aspx"
                            + "?CwztGUID=" + escape(document.all.ddlCwzt.value)
                            + "&CwztName=" + escape(document.all.ddlCwzt.options[document.all.ddlCwzt.selectedIndex].text)
							+ "&HsTypeGUID=" + escape(document.all.SelectProject.value)
							+ "&HsTypeName=" + escape(document.all.SelectProject.options[document.all.SelectProject.selectedIndex].text)
							+ "&isReExp=" + escape(iType);
							
		        //取消已生成的凭证
		        CreateLoadingDiv("正在导出会计辅助核算记录，请等待", parent.document, 320);

		        openXMLHTTPAsync(sFile, "ExportFzhsxm"); 
		    }

		    function XMLHTTPAsyncComplete(sRtn) {
		        closeWaitingDiv(parent.document);

		        sRtn = sRtn.split("|");
		        if (sRtn.length == 3 && sRtn[0] == "OK") {
		            alert("成功导出" + sRtn[1].toString() + "条会计辅助核算记录！");

		            //导出成功重新刷新
		            appIframe.appGrid.frameElement.Query();

		            if (sRtn[2] != "") {
		                OpenDownloadWin("会计辅助核算输出文件.zip", sRtn[2]);
		            }

		        }
		        else {
		            alert(sRtn[0]);
		        }
		    }	 
		</script>
	</HEAD>
	<body MS_POSITIONING="GridLayout"  style="margin-top:15px;margin-left:15px; margin-right:15px">
	    <form id="Form1" method="post" runat="server">
		<asp:textbox id="txtGUIDs" runat="server" style="DISPLAY:none"></asp:textbox>
		<asp:textbox id="txtRight" runat="server" style="DISPLAY:none"></asp:textbox>
		
		<table style="FONT-SIZE: 9pt" height="100%" cellSpacing="0" cellPadding="0" width="100%">
		    <tr height="24">
		        <td width="160" align="right"><b style="COLOR:red">账套:</b></td>
		        <td width="80%"><asp:dropdownlist id="ddlCwzt" Width="100%" runat="server" onchange="SetFzhsxm(this.value)"></asp:dropdownlist></td>
		    </tr>
		    <tr height="24">
		        <td width="160" align="right"><b style="COLOR:red">会计辅助核算项目:</b></td>
		        <td width="80%" id="tdProject">
					<select name="SelectProject" style="WIDTH:100%" onchange="SelectFzhsxm()">
						<option value='' selected></option>
					</select>
				</td>
		    </tr>
		    <tr height="24">
		    </tr>
		    <tr height="100">
				<td colSpan="2">
					<span style="PADDING-LEFT:8px" id="span1"><b>说明：</b></span>
					<br>		
					&nbsp;&nbsp;&nbsp;&nbsp;<span style="PADDING-LEFT:8px" id="span2">本功能与用友NC财务软件对接，可以将明源的基础资料导出并导入用友NC系统具体步骤如下：</span>
					<br>
					&nbsp;&nbsp;&nbsp;&nbsp;<span style="PADDING-LEFT:8px" id="span3">1、按照软件向导将明源基础资料转成NC的基础资料格式；</span>
					<br>
					&nbsp;&nbsp;&nbsp;&nbsp;<span style="PADDING-LEFT:8px" id="span4">2、将转换完成的凭证从网上下载到本地；</span>
					<br>
					&nbsp;&nbsp;&nbsp;&nbsp;<span style="PADDING-LEFT:8px" id="span5">3、通过NC软件的“资料引入”功能将下载的资料引入。</span>
					<br>
				</td>
			</tr>
			<tr height="80%">			    
		        <td colSpan="2">
		            <iframe id="appIframe" src="" width="100%" height="100%" frameborder="0"
						scrolling="no"></iframe>
			    </td>			    
			</tr>
			<tr height="50" id="trsp">
				<td colSpan="2" align="right">
					<button id="btnRenewExport" onclick="Export(1);" type="button" disabled ="true">重新导出</button>&nbsp;&nbsp;
					<button id="btnExport" onclick="Export(0);"  type="button" disabled ="true">导 出</button>
				</td>
			</tr>
		</table>
		</form>
	</body>
</HTML>